/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package test;

import java.util.Date;
import co.srm.entidades.Usuario;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
import javax.persistence.EntityManagerFactory;
import co.srm.entidades.Pago;
import co.srm.dao.JPAGenericDAO;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author TilZon
 */
public class test {
      JPAGenericDAO<Pago> daoPago ;
      JPAGenericDAO<Usuario> daoUser;

    public test() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
        this.daoPago=new JPAGenericDAO<Pago>(Pago.class);
        this.daoUser=new JPAGenericDAO<Usuario>(Usuario.class);
    }

    @After
    public void tearDown() {
    }

    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //
     @Test
     public void inicio() {

//        String UNIDAD_DE_PERSISTENCIA = "SRMPU";
//        EntityManagerFactory factory = Persistence.createEntityManagerFactory(UNIDAD_DE_PERSISTENCIA, System.getProperties());
//        EntityManager em = factory.createEntityManager();
//
//        em.getTransaction().begin();
        Usuario u=new Usuario();
        Pago p = new Pago();
        p.setAbono(20000.0);
        p.setFecha(new Date());
        u.setLogin("user");
//        u.setFechaRegistro(new Date());

        //em.persist(p);
        //em.flush();
//        em.getTransaction().commit();
//
//        em.close();
        this.daoUser.save(u);
        //daoPago.save(p);

     }

}